<!DOCTYPE html>
<html>

	<head>
		<meta charset="UTF-8">
		<title>requestAnimationFrame案例</title>
		<style type="text/css">
			#progress {
				height: 10px;
				background: blue;
			}
		</style>
	</head>

	<body>
		<div id="progress"></div>
		<script>
			var progress = document.getElementById("progress");

			var i = 0;

			function F() {
				console.log(++i);
				progress.style.width = i + "px";
				if(i < 300) {
					requestAnimationFrame(F);
				}
			}

			requestAnimationFrame(F);
		</script>
	</body>

</html>